<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>dojox.Grid Sizing Example</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
	<style type="text/css">
		@import "../../../../dojo/resources/dojo.css";
		@import "../../../../dijit/tests/css/dijitTests.css";
		@import "../../_grid/tundraGrid.css";
		@import "../../../layout/resources/ResizeHandle.css";

		.heading {
			font-weight: bold;
			padding-bottom: 0.25em;
		}
		
		#bar, #container {
			width: 400px;
			height: 200px;
			border: 4px double #333; 
		}
				
		#grid { 
			border: 1px solid #333;
		}
	</style>
	<script type="text/javascript" src="../../../../dojo/dojo.js" 
		djConfig="isDebug:true, parseOnLoad: true"></script>

	<script type="text/javascript">
		dojo.require("dojox.grid.Grid");
		dojo.require("dojo.parser");
		dojo.require("dojox.layout.ResizeHandle");
	</script>
	<script type="text/javascript">
		data = [ 
			[ "normal", false, "new", 'But are not followed by two hexadecimal', 29.91, 10, false ],
			[ "important", false, "new", 'Because a % sign always indicates', 9.33, -5, false ],
			[ "important", false, "read", 'Signs can be selectively', 19.34, 0, true ],
			[ "note", false, "read", 'However the reserved characters', 15.63, 0, true ],
			[ "normal", false, "replied", 'It is therefore necessary', 24.22, 5.50, true ],
			[ "important", false, "replied", 'To problems of corruption by', 9.12, -3, true ],
			[ "note", false, "replied", 'Which would simply be awkward in', 12.15, -4, false ]
		];
		model = new dojox.grid.data.table(null, data);
		
		// grid structure
		// a grid view is a group of columns
		// a special view providing selection feedback
		var rowBar = {type: 'dojox.GridRowView', width: '20px'};
		
		// a view without scrollbars
		var leftView = {
			noscroll: false,
			cells: [[
				{name: 'Column 0'},
				{name: 'Column 1'}
		]]};
		
		var middleView = {
			cells: [[
				{name: 'Column 2'},
				{name: 'Column 3'},
				{name: 'Column 4'},
				{name: 'Column 5'},
				{name: 'Column 6'}
		]]};
		
		// a grid structure is an array of views.
		var structure = [ rowBar, leftView, middleView];
		
		// get can return data for each cell of the grid
		function get(inRowIndex) {
			return [this.index, inRowIndex].join(', ');
		}

		dojo.addOnLoad(function(){
			var hand = new dojox.layout.ResizeHandle({
				targetContainer: dojo.byId("bar"),
				animateSizing: false,
				onResize: function(e){
					setTimeout(dojo.hitch(aGrid,"resize",e),25);
				}
			},"hand0");
		});
		
	
</script>
</head>
<body class="tundra">
<div class="heading">dojox.Grid Sizing Test w/ the experimental dojox.layout.ResizeHandle</div>
	
	<p>While this test should work, dojox.layout.ResizeHandle is experimental.</p>
	
	<div id="bar" style="position:relative">
		<div jsId="aGrid" id="grid" dojoType="dojox.Grid" model="model" structure="structure" elasticView="2"></div>
		<div id="hand0"></div>
	</div>
	
	<p>Grid fits to a sized container by default:</p>
	<div id="container" style="position:relative">
		<div jsId="theGrid" id="grid1" dojoType="dojox.VirtualGrid" get="get" structure="structure" rowCount="75" elasticView="2"></div>
		<div id="hand1" dojoType="dojox.layout.ResizeHandle" targetId="container" onResize="setTimeout(dojo.hitch(theGrid,'update'),50)" animateSizing="false"></div>
	</div>
	
	<p>I am here to take up</p>

	<p>space</p>

	<p>as much as needed.</p>
		
</body>
</html>
